***Table 1 Statistical Description of Main Variables
set matsize 11000
use data_s.dta,clear  
outreg2 using describe.doc,replace sum(log) keep (Rs RCE NE Sx1 Sx2 Sx3 Sx4 Sx5 ) title(Rs Decriptive statistics)
use data_c.dta,clear
outreg2 using describe.doc,append sum(log) keep (Rc RCE NE Cx1 Cx2 Cx3 Cx4 Cx5 ) title(Rc Decriptive statistics)
unicode convertfile describe.doc tans_describe.doc,dstencoding("gb2312") replace
shellout using `"tans_describe.doc"'

***Table 4 Results of the Baseline Model Regression
spatwmat using w2_0.dta,name(W2)

use data.dta,clear 
xtset ID 年度区间

global X1 "Sx1 Sx2 Sx3 Sx4 Sx5" 
xsmle Rs RCE $X1, wmat(W2) model(sdm) durbin(RCE) effects type(both)  //sdm
outreg2 using basic.doc,replace tstat ctitle(RCE) bdec(3) tdec(2)         
xsmle Rs NE $X1, wmat(W2) model(sdm) durbin(NE) effects type(both)  //sdm
outreg2 using basic.doc,append tstat ctitle(NE) bdec(3) tdec(2) 
unicode convertfile basic.doc tans_basic.doc,dstencoding("gb2312") replace          
shellout using `"tans_basic.doc"' 


***Table 5 Regression results for the Recession Phase
spmatrix import WT2 using WT2.txt

use data_s.dta,clear   

spregress Rs RCE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  ivarlag(WT2:RCE $X1)
outreg2 using basic.doc,replace tstat ctitle(SA) bdec(3) tdec(2)  
estat impact       
spregress Rs NE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  ivarlag(WT2:NE $X1)
outreg2 using basic.doc,append tstat ctitle(SS) bdec(3) tdec(2)         
estat impact

***Table 6 Regression results for the Recovery Phase
spmatrix import WT3 using WT3.txt

use data_c.dta,clear   

global X2 "Cx1 Cx2 Cx3 Cx4 Cx5 "
          
spregress Rc RCE $X2, gs2sls dvarlag(WT3) errorlag(WT3) ivarlag(WT3: RCE $X2)  
outreg2 using basic.doc,replace tstat ctitle(RCE) bdec(3) tdec(2) 
estat impact  

spregress Rc NE $X2, gs2sls dvarlag(WT3) errorlag(WT3) ivarlag(WT3: NE $X2)  
outreg2 using basic.doc,append tstat ctitle(NE) bdec(3) tdec(2) 
estat impact  

unicode convertfile basic.doc tans_basic.doc,dstencoding("gb2312") replace          
shellout using `"tans_basic.doc"' 


***Table 7 The random failure of nodes in the supply chain network
spatwmat using w2_0.dta,name(W2) 
spatwmat using Tw2_1_0.dta,name(W2_1)
spatwmat using Tw2_5_0.dta,name(W2_5)
spatwmat using Tw2_20_0.dta,name(W2_20)
spatwmat using Tw2_K_0.dta,name(W2_K) standardize 
spatwmat using Tw2_NK_0.dta,name(W2_NK)

use data.dta,clear    
xtset ID 年度区间

xsmle Rs RCE $X1, wmat(W2_1) model(sdm) durbin(RCE) effects type(both)  
outreg2 using basic1.doc,replace tstat ctitle(RCE) bdec(3) tdec(2)         
xsmle Rs NE $X1, wmat(W2_1) model(sdm) durbin(NE) effects type(both)  
outreg2 using basic1.doc,append tstat ctitle(NE) bdec(3) tdec(2) 
unicode convertfile basic1.doc tans_basic1.doc,dstencoding("gb2312") replace          
shellout using `"tans_basic1.doc"' 

xsmle Rs RCE $X1, wmat(W2_5) model(sdm) durbin(RCE) effects type(both)  
outreg2 using basic5.doc,replace tstat ctitle(RCE) bdec(3) tdec(2)         
xsmle Rs NE $X1, wmat(W2_5) model(sdm) durbin(NE) effects type(both)  
outreg2 using basic5.doc,append tstat ctitle(NE) bdec(3) tdec(2) 
unicode convertfile basic5.doc tans_basic5.doc,dstencoding("gb2312") replace          
shellout using `"tans_basic5.doc"' 

xsmle Rs RCE $X1, wmat(W2_20) model(sdm) durbin(RCE) effects type(both)  
outreg2 using basic20.doc,replace tstat ctitle(RCE) bdec(3) tdec(2)         
xsmle Rs NE $X1, wmat(W2_20) model(sdm) durbin(NE) effects type(both)  
outreg2 using basic20.doc,append tstat ctitle(NE) bdec(3) tdec(2) 
unicode convertfile basic20.doc tans_basic20.doc,dstencoding("gb2312") replace          
shellout using `"tans_basic20.doc"' 

***Table 8 The failure of critical nodes in the supply chain network
xsmle Rs RCE $X1, wmat(W2_K) model(sdm) durbin(RCE) effects type(both)  
outreg2 using basicK.doc,replace tstat ctitle(RCE) bdec(3) tdec(2)         
xsmle Rs NE $X1, wmat(W2_K) model(sdm) durbin(NE) effects type(both)  
outreg2 using basicK.doc,replace tstat ctitle(NE) bdec(3) tdec(2) 
unicode convertfile basicK.doc tans_basicK.doc,dstencoding("gb2312") replace          
shellout using `"tans_basicK.doc"' 

xsmle Rs RCE $X1, wmat(W2_NK) model(sdm) durbin(RCE) effects type(both)  
outreg2 using basicNK.doc,replace tstat ctitle(RCE) bdec(3) tdec(2)         
xsmle Rs NE $X1, wmat(W2_NK) model(sdm) durbin(NE) effects type(both)  
outreg2 using basicNK.doc,append tstat ctitle(NE) bdec(3) tdec(2) 
unicode convertfile basicNK.doc tans_basicNK.doc,dstencoding("gb2312") replace          
shellout using `"tans_basicNK.doc"' 


***Figure 5 Heterogeneity for digital economy development
spmatrix import WT3 using WT3.txt  

*企业数字化的异质性
//数字化程度低的
use data_c.dta,clear
egen mean_数=mean(数字化转型)
keep if 数字化转型<=mean_数

spivregress SRc RCE $X2, gs2sls dvarlag(WT3) errorlag(WT3)  force
estat impact
est store Rc31 
spivregress SRc NE $X2, gs2sls dvarlag(WT3) errorlag(WT3)  force
estat impact
est store Rc41

//数字化程度高的
use data_c.dta,clear
egen mean_数=mean(数字化转型)
keep if 数字化转型>=mean_数

spivregress SRc RCE $X2, gs2sls dvarlag(WT3) errorlag(WT3) force
estat impact
est store Rc32
spivregress SRc NE $X2, gs2sls dvarlag(WT3) errorlag(WT3) force
estat impact
est store Rc42 
 
//冲击抵御期韧性
spmatrix import WT2 using WT2.txt  

//数字化程度低的
use data_s.dta,clear
*astile 数=数字化转型, nq(4)
egen 数=mean(数字化转型)
keep if 数字化转型<数

spivregress SRs RCE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  force
estat impact
est store Rs31 
spivregress SRs NE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  force
estat impact
est store Rs41 


//数字化程度高的
use data_s.dta,clear
egen mean_数=median(数字化转型)
keep if 数字化转型>=mean_数

spivregress Rs RCE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  force
estat impact
est store Rs32
spivregress Rs NE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  force
estat impact
est store Rs42

*graph

coefplot  (Rs31,label("S_Low") pstyle(p1)) (Rs32,label("S_High") pstyle(p2))(Rc31,label("C_Low") pstyle(p1)) (Rc32,label("C_High") pstyle(p2)), drop(_cons) xline(0, lp(dash) lc(black*0.3))  keep(RCE RCE)  levels(95 50) ciopts(recast(. rcap))
coefplot  (Rs41,label("S_Low") pstyle(p1)) (Rs42,label("S_High") pstyle(p2))(Rc41,label("C_Low") pstyle(p1)) (Rc42,label("C_High") pstyle(p2)), drop(_cons) xline(0, lp(dash) lc(black*0.3))  keep(NE NE)  levels(95 50) ciopts(recast(. rcap))

***Figure 6 Heterogeneity for market integration
//市场化程度低的
use data_c.dta,clear
egen mean_市=mean(市场化进程总得分)
keep if 市场化进程总得分<=mean_市

spivregress Rc RCE $X2, gs2sls dvarlag(WT3) errorlag(WT3)  force
est store Rc31 
estat impact
spivregress Rc NE $X2, gs2sls dvarlag(WT3) errorlag(WT3)  force
est store Rc41 
estat impact

//市场化程度高的
use data_c.dta,clear
egen mean_市=mean(市场化进程总得分)
keep if 市场化进程总得分>=mean_市

spivregress Rc RCE $X2, gs2sls dvarlag(WT3) errorlag(WT3) force
est store Rc32 
estat impact
spivregress Rc NE $X2, gs2sls dvarlag(WT3) errorlag(WT3) force
est store Rc42 
estat impact

//市场化程度低的
use data_s.dta,clear
egen mean_市=mean(市场化进程总得分)
keep if 市场化进程总得分<=mean_市

spivregress Rs RCE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  force
estat impact
est store Rs31 
spivregress Rs NE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  force
estat impact
est store Rs41 

//市场化程度高的
use data_s.dta,clear
egen mean=median(市场化进程总得分)
keep if 市场化进程总得分>mean

spivregress Rs RCE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  force
estat impact
est store Rs32
spivregress Rs NE $X1, gs2sls dvarlag(WT2) errorlag(WT2)  force
estat impact
est store Rs42

*graph

coefplot  (Rs31,label("S_Low") pstyle(p1)) (Rs32,label("S_High") pstyle(p2))(Rc31,label("C_Low") pstyle(p1)) (Rc32,label("C_High") pstyle(p2)), drop(_cons) xline(0, lp(dash) lc(black*0.3))  keep(RCE RCE)  levels(95 50) ciopts(recast(. rcap))
coefplot  (Rs41,label("S_Low") pstyle(p1)) (Rs42,label("S_High") pstyle(p2))(Rc41,label("C_Low") pstyle(p1)) (Rc42,label("C_High") pstyle(p2)), drop(_cons) xline(0, lp(dash) lc(black*0.3))  keep(NE NE)  levels(95 50) ciopts(recast(. rcap))
